*Table A.20: Baseline health biomarkers (based on fasted blood samples)
cd ""

use master_data_adults_child_s13456_shared.dta, clear 

drop meal_control snack_control
gen meal_control=1 if treatment==2
replace meal_control=0 if treatment==1

gen snack_control=1 if treatment==3
replace snack_control=0 if treatment==1	

drop if type_id=="X" // **Dropping newborns born during the three years of study
drop if id=="3885553B" //**error in the id number and empty data
drop if id=="3885553G" //**error in the id number and empty data
replace treatment=2 if id=="38855553B" //**retrieving the correct treatment for this id
replace treatment=2 if id=="38855553G" //**retrieving the correct treatment for this id
drop if id=="101aa22c" //**this id does not exist


drop if edi==0
keep if session==1 | session==3

**baseline
eststo clear
bys treatment  : eststo:  qui estpost  sum nefa insulin trig hdl glucose calc_ldl crp tas if session==1
esttab using "blood_results.xls", cells("mean(fmt(1)) sd(fmt(1)) min(fmt(1)) max(fmt(1)) count(fmt(0))") tab label collabels("Mean" "Std. Dev." "Min." "Max." "N")  title("blood results") mtitle("Session 1 Control" "Session 1 Meal" "Session 1 Snack" )  addnotes("")  nonumber noobs replace
 
foreach v of var nefa- nefa insulin trig hdl glucose calc_ldl crp tas {
ttest `v'	if session==1, by(meal_control)
ttest `v'	if session==1, by(snack_control)	
}